﻿<!--<Window x:Class="WPFXMPPClient.GeoLocationWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    Title="WPF Map App" Width="581" WindowStyle="None" AllowsTransparency="False" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" WindowStartupLocation="CenterScreen" Loaded="Window1_Loaded">-->
    
   
<Window x:Class="WPFXMPPClient.GeoLocationWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="http://schemas.microsoft.com/surface/2008"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:phone="clr-namespace:System.Net.XMPP;assembly=xmpp"
    xmlns:comp="clr-namespace:System.ComponentModel;assembly=WindowsBase"
    xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
    xmlns:extra="clr-namespace:WPFImageWindows;assembly=WPFImageWindows"
        xmlns:local="clr-namespace:WPFXMPPClient"
        AllowsTransparency="False" WindowStyle="None"
        MouseDown="Window_MouseDown"  ResizeMode="CanResizeWithGrip" Loaded="Window_Loaded" Width="500" Height="500"
        Title="GeoLocationWindow">

    <!--  ResizeMode="CanResizeWithGrip"  -->
    <Window.Resources>
        <Storyboard x:Key="StoryBoardMakeBigGlobe">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ButtonGlobe">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ButtonGlobe">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="StoryBoardMakeBigSpeaker">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ButtonStartAudio">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ButtonStartAudio">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="StoryBoardMakeBigChat">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ToggleButtonChat">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ToggleButtonChat">
                <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1.6"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <DataTemplate x:Key="ChatMessageTemplate">
            <Grid Background="{x:Null}"  HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="74" />
                    <ColumnDefinition Width="300*" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="50*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>


                <Grid.Triggers>
                    <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="ButtonGlobe">
                        <BeginStoryboard x:Name="StoryBoardMakeBigGlobe_BeginStoryboard" Storyboard="{StaticResource StoryBoardMakeBigGlobe}"/>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="ButtonGlobe">
                        <StopStoryboard BeginStoryboardName="StoryBoardMakeBigGlobe_BeginStoryboard"/>
                    </EventTrigger>

                    <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="ButtonStartAudio">
                        <BeginStoryboard x:Name="StoryBoardMakeBigSpeaker_BeginStoryboard" Storyboard="{StaticResource StoryBoardMakeBigSpeaker}"/>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="ButtonStartAudio">
                        <StopStoryboard BeginStoryboardName="StoryBoardMakeBigSpeaker_BeginStoryboard"/>
                    </EventTrigger>

                    <EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="ToggleButtonChat">
                        <BeginStoryboard x:Name="StoryBoardMakeBigChat_BeginStoryboard" Storyboard="{StaticResource StoryBoardMakeBigChat}"/>
                    </EventTrigger>
                    <EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="ToggleButtonChat">
                        <StopStoryboard BeginStoryboardName="StoryBoardMakeBigChat_BeginStoryboard"/>
                    </EventTrigger>
                </Grid.Triggers>

                <Rectangle VerticalAlignment="Top" Stroke="{Binding Presence.PresenceBrush}" Grid.RowSpan="1" StrokeThickness="1" Stretch="Uniform"  Fill="{Binding Presence.PresenceBrush}" Grid.Column="0" Grid.Row="0" />
                <Image VerticalAlignment="Top" Grid.Column="0" Grid.Row="0" Grid.RowSpan="1" Margin="4" Source="{Binding Avatar}" Stretch="Uniform" />


                <!--<Button Style="{DynamicResource ButtonSurface}"  
                             VerticalContentAlignment="Stretch" x:Name="HyperlinkRosterItem" Click="HyperlinkRosterItem_Click" >
                            <Button.ContextMenu>
                                <ContextMenu >
                                    <MenuItem Header="Options">
                                        <MenuItem x:Name="MenuItemSubscribe" Click="MenuItemSubscribe_Click" Header="Subscribe" />
                                        <MenuItem x:Name="MenuItemUnsubscribe" Click="MenuItemUnsubscribe_Click" Header="Unsubscribe" />
                                    </MenuItem>
                                </ContextMenu>
                            </Button.ContextMenu>

                        <Button.Content>-->
                <Grid Grid.Row="0" Grid.Column="1" Margin="10,0" Background="{DynamicResource ButtonBrush}" MouseDown="Grid_MouseDown" MouseUp="Grid_MouseUp">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35" />
                        <RowDefinition Height="70*" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="300*" />
                        <ColumnDefinition Width="35" />
                        <ColumnDefinition Width="35" />
                        <ColumnDefinition Width="35" />
                    </Grid.ColumnDefinitions>

                    <local:DialogControl Grid.Row="1" GotFocus="DialogControlLastMessage_GotFocus" Grid.ColumnSpan="4" BorderBrush="{x:Null}" Foreground="{x:Null}" Background="{x:Null}" x:Name="DialogControlLastMessage" Height="50"></local:DialogControl>


                    <TextBlock Grid.Row="0" Grid.Column="0" Margin="10,0,0,0" HorizontalAlignment="Stretch" TextTrimming="CharacterEllipsis">
                    <TextBlock.Inlines>
                        <Run Text="{Binding Path=Name}" FontSize="16" FontWeight="Bold"/>
                        <Run Text="-" />
                        <Run Text="{Binding Path=Presence.Status}" />
                        <LineBreak />
                        <Run Text="{Binding TuneString}" FontSize="10"  />
                    </TextBlock.Inlines>
                    </TextBlock>


                    <Button Grid.Column="1" Visibility="{Binding GeoVisible}" HorizontalAlignment="Stretch" Click="ButtonViewMap_Click" Width="30" Height="30"  RenderTransformOrigin=".5,.5" VerticalAlignment="Stretch"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" x:Name="ButtonGlobe" ToolTip="Show location" >
                        <Button.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform/>
                                <SkewTransform/>
                                <RotateTransform/>
                                <TranslateTransform/>
                            </TransformGroup>
                        </Button.RenderTransform>
                        <Rectangle Stretch="UniformToFill" Fill="{DynamicResource globe}" Width="24" Height="24" />
                    </Button>

                    <Button Width="30" Height="30" Grid.Column="2" HorizontalAlignment="Stretch" Visibility="{Binding AudioVisible}" RenderTransformOrigin=".5,.5" Click="ButtonStartAudio_Click" VerticalAlignment="Stretch"  HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" x:Name="ButtonStartAudio" ToolTip="Start an Audio Call with this chap" >
                        <Button.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform/>
                                <SkewTransform/>
                                <RotateTransform/>
                                <TranslateTransform/>
                            </TransformGroup>
                        </Button.RenderTransform>
                        <Rectangle Stretch="UniformToFill" Fill="{DynamicResource speaker}" Width="24" Height="24" />
                    </Button>

                    <Button Width="30" Height="30"  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"  RenderTransformOrigin=".5,.5" Visibility="{Binding NewMessagesVisible}" Grid.Column="3" x:Name="ToggleButtonChat" Click="HyperlinkRosterItem_Click" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" >
                        <Button.RenderTransform>
                            <TransformGroup>
                                <ScaleTransform/>
                                <SkewTransform/>
                                <RotateTransform/>
                                <TranslateTransform/>
                            </TransformGroup>
                        </Button.RenderTransform>
                        <Rectangle Stretch="UniformToFill"  Width="24" Height="24">
                            <Rectangle.Fill>
                                <DrawingBrush Stretch="Fill">
                                    <DrawingBrush.Drawing>
                                        <DrawingGroup>
                                            <DrawingGroup.Children>
                                                <GeometryDrawing Geometry="F1 M 64,8C 94.9279,8 120,33.0721 120,64C 120,94.9279 94.9279,120 64,120C 33.0721,120 8,94.9279 8,64C 8,33.0721 33.0721,8 64,8 Z ">
                                                    <GeometryDrawing.Brush>
                                                        <RadialGradientBrush RadiusX="0.5" RadiusY="0.5" Center="0.551282,0.448718" GradientOrigin="0.551282,0.448718">
                                                            <RadialGradientBrush.GradientStops>
                                                                <GradientStop Color="#FFA1E5FF" Offset="0"/>
                                                                <GradientStop x:Name="GradientStop2" Color="#FF50A0D3" Offset="0.567442"/>
                                                                <GradientStop Color="#FF005CA7" Offset="1"/>
                                                            </RadialGradientBrush.GradientStops>
                                                            <RadialGradientBrush.RelativeTransform>
                                                                <TransformGroup/>
                                                            </RadialGradientBrush.RelativeTransform>
                                                        </RadialGradientBrush>
                                                    </GeometryDrawing.Brush>

                                                </GeometryDrawing>
                                                <GeometryDrawing Brush="#FF000000" Geometry="F1 M 50.8335,38.3543L 77.1665,38.3543C 85.4508,38.3543 92.1665,45.0701 92.1665,53.3543L 92.1665,65.8541C 92.1665,73.1257 86.9922,79.1889 80.1247,80.5625L 83.5832,95.6457L 67.4874,80.8541L 50.8335,80.8541C 42.5492,80.8541 35.8335,74.1384 35.8335,65.8541L 35.8335,53.3543C 35.8335,45.0701 42.5492,38.3543 50.8335,38.3543 Z "/>
                                            </DrawingGroup.Children>
                                        </DrawingGroup>
                                    </DrawingBrush.Drawing>
                                </DrawingBrush>
                            </Rectangle.Fill>
                            <Rectangle.Triggers>
                                <EventTrigger RoutedEvent="Loaded">
                                    <BeginStoryboard>
                                        <Storyboard RepeatBehavior="Forever">
                                            <DoubleAnimation 
                                                        Storyboard.TargetName="GradientStop2"
                                                        Storyboard.TargetProperty="Offset"
                                                        From="0.1" To="0.8" Duration="0:0:1.5"
                                                        AutoReverse="True" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger>
                            </Rectangle.Triggers>
                        </Rectangle>
                    </Button>

                </Grid>
                <!--</Button.Content>

                    </Button>-->




                <!--<s:ElementMenu>
                        <s:ElementMenuItem x:Name="MenuItemQuery" Click="MenuItemQuery_Click">Query</s:ElementMenuItem>
                    </s:ElementMenu>-->


                <Grid Grid.Row="1" Grid.ColumnSpan="3" x:Name="GridMoreUserOptions"  Visibility="Collapsed">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="74" />
                        <ColumnDefinition Width="300*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RenderTransform>
                        <TranslateTransform X="0" Y="0" />
                    </Grid.RenderTransform>

                    <Grid Grid.Row="0" Grid.Column="1" Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="80*" />
                            <ColumnDefinition Width="24" />
                            <ColumnDefinition Width="24" />
                        </Grid.ColumnDefinitions>
                        <s:SurfaceTextBox Grid.Column="0"  x:Name="TextBoxChatToSend" GotFocus="TextBoxChatToSend_GotFocus" PreviewKeyDown="TextBoxChatToSend_PreviewKeyDown"></s:SurfaceTextBox>
                        <Button Style="{DynamicResource ButtonSurface}"  ToolTip="Send Message" Grid.Column="1"  x:Name="ButtonSend" Click="ButtonSend_Click" >
                            <Image Width="20" Height="20" Source="Images/mail.png" />
                        </Button>
                        <Button Style="{DynamicResource ButtonSurface}" ToolTip="Clear" Grid.Column="2" x:Name="ButtonClearMessages" Click="ButtonClearMessages_Click" >
                            <Image Source="Images/trash.png" Width="20" Height="20" />
                        </Button>

                    </Grid>

                    <!-- <extra:AudioViewerControl Grid.Row="1" Grid.Column="0"/> -->


                </Grid>
                <!--<Rectangle x:Name="RectangleDarken" Grid.RowSpan="2" Grid.ColumnSpan="4" Fill="Black" Visibility="Visible" Opacity=".35" />-->



            </Grid>

            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}, AncestorLevel=1}, Path=IsSelected}" Value="True">
                    <!--<DataTrigger Binding="{Binding ElementName=ButtonExpandChat, Path=IsChecked}" Value="True">-->
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="GridMoreUserOptions" Storyboard.TargetProperty="(Grid.RenderTransform).(TranslateTransform.Y)"  From="-48" To="0" DecelerationRatio="0.5" Duration="0:0:0.8"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                    <Setter Property="Visibility" Value="Visible" TargetName="GridMoreUserOptions" />
                    <Setter Property="Height" Value="120" TargetName="DialogControlLastMessage" />
                    <!--<Setter Property="Visibility" Value="Collapsed" TargetName="RectangleDarken" />-->
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}, AncestorLevel=1}, Path=IsSelected}" Value="False">
                    <Setter Property="Visibility" Value="Collapsed" TargetName="GridMoreUserOptions" />
                    <Setter Property="Height" Value="50" TargetName="DialogControlLastMessage" />
                    <!--<Setter Property="Visibility" Value="Visible" TargetName="RectangleDarken" />-->
                </DataTrigger>
            </DataTemplate.Triggers>

        </DataTemplate>
        <Style x:Key="BorderStyle1" TargetType="{x:Type Border}">
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <RadialGradientBrush>
                        <GradientStop Color="#FF136814" Offset="1"/>
                        <GradientStop Color="#FFA5EBA6" Offset="0"/>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>


        <CollectionViewSource x:Key="SortedRosterItems" x:Name="OurSortedRosterCollection">
            <CollectionViewSource.SortDescriptions>
                <comp:SortDescription PropertyName="Name" />
            </CollectionViewSource.SortDescriptions>
            <CollectionViewSource.GroupDescriptions>
                <dat:PropertyGroupDescription PropertyName="Group" />
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>
        
        <Style x:Key="CloseButtonStyle" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Viewbox x:Name="Close">
                                <Canvas Width="15.4167" Height="15.5001">
                                    <Path x:Name="Rect1" Width="15.4167" Height="15.5001" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" Fill="#00000000" Data="F1 M 2,0L 13.4167,0C 14.5212,0 15.4167,0.895447 15.4167,2L 15.4167,13.5001C 15.4167,14.6046 14.5212,15.5001 13.4167,15.5001L 2,15.5001C 0.895447,15.5001 0,14.6046 0,13.5001L 0,2C 0,0.895447 0.895447,0 2,0 Z "/>
                                    <Path x:Name="X1" Width="15.001" Height="15.001" Canvas.Left="0.209" Canvas.Top="0.235" Stretch="Fill" Fill="#FF000000" Data="F1 M 14.7216,0.723328C 15.3725,1.37421 15.3725,2.4295 14.7216,3.08038L 10.0667,7.73535L 14.7218,12.3905C 15.3727,13.0414 15.3726,14.0966 14.7217,14.7475C 14.0709,15.3984 13.0156,15.3984 12.3647,14.7475L 7.70959,10.0924L 3.05438,14.7476C 2.4035,15.3985 1.34827,15.3985 0.697388,14.7476C 0.0465088,14.0967 0.0465088,13.0414 0.697388,12.3906L 5.3526,7.73541L 0.697449,3.08026C 0.0465698,2.42938 0.0465698,1.37415 0.697449,0.723267C 1.34833,0.0723877 2.40363,0.0723877 3.0545,0.723267L 7.70966,5.37836L 12.3646,0.723328C 13.0155,0.0724487 14.0707,0.0724487 14.7216,0.723328 Z "/>
                                    <Path x:Name="X2" Width="13.6364" Height="13.6351" Canvas.Left="0.891403" Canvas.Top="0.91861" Stretch="Fill" Fill="#FFD7D7D7" Data="F1 M 1.19855,1.2243C 1.60614,0.816711 2.26715,0.816711 2.67474,1.2243L 7.70966,6.25922L 12.7444,1.22443C 13.152,0.816711 13.813,0.816711 14.2207,1.22437C 14.6284,1.63202 14.6284,2.29303 14.2206,2.70062L 9.18585,7.73541L 14.222,12.7716C 14.6297,13.1793 14.6297,13.8402 14.222,14.2479C 13.8143,14.6556 13.1535,14.6556 12.7458,14.2479L 7.70966,9.21173L 2.67346,14.2479C 2.26575,14.6556 1.6048,14.6556 1.19714,14.2479C 0.78949,13.8403 0.78949,13.1793 1.19714,12.7716L 6.23334,7.73541L 1.19855,2.70062C 0.790894,2.29297 0.790833,1.63202 1.19855,1.2243 Z "/>
                                </Canvas>
                            </Viewbox>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="X2" Value="#FF67C8FF"/>
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True"/>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="MinimizeButtonStyle" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Viewbox x:Name="Minimize">
                                <Canvas Width="15.4166" Height="15.5">
                                    <Path x:Name="Rect" Width="15.4166" Height="15.5" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" Fill="#00C80000" Data="F1 M 2,0L 13.4166,0C 14.5212,0 15.4166,0.895386 15.4166,2L 15.4166,13.5C 15.4166,14.6046 14.5212,15.5 13.4166,15.5L 2,15.5C 0.895386,15.5 0,14.6046 0,13.5L 0,2C 0,0.895386 0.895386,0 2,0 Z "/>
                                    <Path x:Name="Path" Width="15" Height="3.29211" Canvas.Left="0.203247" Canvas.Top="12.0621" Stretch="Fill" Fill="#FF000000" Data="F1 M 1.84924,12.0621L 13.5572,12.0621C 14.4663,12.0621 15.2032,12.7991 15.2032,13.7082L 15.2032,13.7082C 15.2032,14.6173 14.4663,15.3542 13.5572,15.3542L 1.84924,15.3542C 0.940186,15.3542 0.203247,14.6173 0.203247,13.7082L 0.203247,13.7082C 0.203247,12.7991 0.940186,12.0621 1.84924,12.0621 Z "/>
                                    <Path x:Name="Path_0" Width="13.6262" Height="2.20911" Canvas.Left="0.890076" Canvas.Top="12.6036" Stretch="Fill" Fill="#FFCBCBCB" Data="F1 M 1.99463,12.6036L 13.4117,12.6036C 14.0218,12.6036 14.5162,13.0981 14.5162,13.7082L 14.5162,13.7082C 14.5162,14.3182 14.0218,14.8127 13.4117,14.8127L 1.99463,14.8127C 1.38458,14.8127 0.890076,14.3182 0.890076,13.7082L 0.890076,13.7082C 0.890076,13.0981 1.38458,12.6036 1.99463,12.6036 Z "/>
                                </Canvas>
                            </Viewbox>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="Path_0" Value="#FF67C8FF"/>
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True"/>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="SendButtonControlTemplate" TargetType="{x:Type Button}">
            <Grid x:Name="grid">
                <Rectangle x:Name="BgrndRct" Stroke="#FFECAC00" RadiusX="3.25" RadiusY="3.25" Fill="#CB2E2E2E"/>
                <Rectangle x:Name="GlowRct" RadiusX="2.5" RadiusY="2.5" Margin="1,1.125,1,1.167" Opacity="0">
                    <Rectangle.Fill>
                        <RadialGradientBrush Center="0.496,0.997" GradientOrigin="0.478,1.029" RadiusX="1.055" RadiusY="1.055">
                            <GradientStop Color="#B8C91616" Offset="0"/>
                            <GradientStop Color="#00A90D0D" Offset="0.901"/>
                        </RadialGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle x:Name="ShineRct" RadiusX="2.5" RadiusY="2.5" Margin="1,1.125,1,11.667">
                    <Rectangle.Fill>
                        <LinearGradientBrush MappingMode="RelativeToBoundingBox" EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#87FFFFFF" Offset="0"/>
                            <GradientStop Color="#10FFFFFF" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Opacity" TargetName="GlowRct" Value="1"/>
                    <Setter Property="Opacity" TargetName="ShineRct" Value="0.8"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="ShowButtonControlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle x:Name="BgrndRct" Stroke="#FF131A1C" RadiusX="3.25" RadiusY="3.25" Fill="#D91A1A1A"/>
                <Rectangle x:Name="GlowRct" RadiusX="2.5" RadiusY="2.5" Margin="1,1.125,1,1.141" Opacity="0">
                    <Rectangle.Fill>
                        <RadialGradientBrush Center="0.496,0.997" GradientOrigin="0.478,1.029" RadiusX="1.055" RadiusY="1.055">
                            <GradientStop Color="#B81688C9" Offset="0"/>
                            <GradientStop Color="#000D78A9" Offset="0.901"/>
                        </RadialGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle x:Name="ShineRct" RadiusX="2.5" RadiusY="2.5" Margin="1.25,1.25,1.25,12.849" VerticalAlignment="Stretch">
                    <Rectangle.Fill>
                        <LinearGradientBrush MappingMode="RelativeToBoundingBox" EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#87FFFFFF" Offset="0"/>
                            <GradientStop Color="#10FFFFFF" Offset="1"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="BgrndRct" Value="#F32E2E2E"/>
                    <Setter Property="Opacity" TargetName="GlowRct" Value="1"/>
                    <Setter Property="Opacity" TargetName="ShineRct" Value="0.875"/>
                    <Setter Property="Stroke" TargetName="BgrndRct" Value="#FF313131"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="ZoomInButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="ZoomInBgrndRct"/>
                <Path Fill="#F1FFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" Margin="5.83,6.083,5.83,6.083" RenderTransformOrigin="0.500000003172494,0.500000010877122" Data="M7.5809999,0 L9.2529998,0 C9.747295,0 10.148,0.40070518 10.148,0.89499998 L10.148,6.6859999 15.939,6.6859999 C16.433293,6.6859999 16.834,7.0867053 16.834,7.5809999 L16.834,9.2530003 C16.834,9.7472935 16.433293,10.148 15.939,10.148 L10.148,10.148 10.148,15.939 C10.148,16.433297 9.7472936,16.834 9.2529998,16.834 L7.5809999,16.834 C7.0867063,16.834 6.6859998,16.433297 6.6859999,15.939 L6.6859999,10.148 0.89499998,10.148 C0.40070413,10.148 0,9.7472927 0,9.2530003 L0,7.5809999 C0,7.086706 0.4007045,6.6859999 0.89499998,6.6859999 L6.6859999,6.6859999 6.6859999,0.89499998 C6.6859998,0.4007051 7.086705,0 7.5809999,0 z" x:Name="Cross">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="90"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="Cross" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="ZoomOutButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="ZoomInBgrndRct"/>
                <Rectangle Fill="#F2FFFFFF" Stroke="{x:Null}" RadiusX="0.648" RadiusY="0.648" HorizontalAlignment="Stretch" Margin="10.929,6.4,10.654,6.684" VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5" StrokeThickness="0.5" Opacity="1" x:Name="MinusRct" >
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="90"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="MinusRct" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="SaveButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Image x:Name="SaveImage" Stretch="Fill" Margin="1.019,1.209,1.018,0.833" Opacity="1"/>
            </Grid>
        </ControlTemplate>
        <ControlTemplate x:Key="SaveButtonControlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="2.5" RadiusY="2.5" x:Name="ZoomInBgrndRct"/>
                <Rectangle Fill="#E0FFFFFF" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="3.92,1.435,3.83,10.172" VerticalAlignment="Stretch" x:Name="LabelRct"/>
                <Rectangle Fill="#97000000" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.413" RadiusY="0.413" Margin="5.022,0,3.83,0.927" VerticalAlignment="Bottom" Height="6.626" x:Name="SlideRgnRct"/>
                <Path Fill="#F2F0F0F0" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" Margin="5.398,0,6.87,0.926" VerticalAlignment="Bottom" Height="6.314" Data="M1.318,0.74899988 C1.1467917,0.74899994 1.008,0.88779168 1.008,1.0589999 L1.008,5.0040001 C1.008,5.175208 1.1467917,5.3140001 1.318,5.3140001 L3.346,5.3140001 C3.5172083,5.3140001 3.6559999,5.175208 3.6559999,5.0040001 L3.6559999,1.0589999 C3.6559999,0.88779168 3.5172083,0.74899994 3.346,0.74899988 z M0.31000003,2.8421709E-14 L12.089,2.8421709E-14 C12.260208,-7.465465E-08 12.399,0.13879165 12.399,0.30999984 L12.399,6.0040001 C12.399,6.175208 12.260208,6.3140001 12.089,6.3140001 L0.31000003,6.3140001 C0.13879173,6.3140001 0,6.175208 0,6.0040001 L0,0.30999984 C0,0.13879165 0.13879173,-7.465465E-08 0.31000003,2.8421709E-14 z" x:Name="MetalRct"/>
                <Rectangle Fill="#E0454545" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="4.791,3.979,4.543,0" VerticalAlignment="Top" Height="0.75"/>
                <Rectangle Fill="#E0454545" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="4.791,6.064,4.543,0" VerticalAlignment="Top" Height="0.75"/>
                <Rectangle Fill="#E0454545" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="4.791,8.149,4.543,0" VerticalAlignment="Top" Height="0.75"/>
                <Rectangle Fill="#E0454545" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="4.791,10.36,4.543,0" VerticalAlignment="Top" Height="0.75"/>
                <Rectangle Fill="#E0454545" Stroke="{x:Null}" StrokeThickness="0.5" RadiusX="0.33" RadiusY="0.33" Margin="4.791,0,4.543,11.744" VerticalAlignment="Bottom" Height="0.75"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="LabelRct" Value="#FFFFFFFF"/>
                    <Setter Property="Fill" TargetName="MetalRct" Value="#FFF0F0F0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="RoadmapButtonCtrlTemplate" TargetType="{x:Type ToggleButton}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="ZoomInBgrndRct"/>
                <ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Content="Roadmap" Foreground="#EEE3E3E3" x:Name="contentControl" FontSize="11"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#FFFFFFFF"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#F965BDFF"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="HybridToggleButtonCtrlTemplate" TargetType="{x:Type ToggleButton}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="ZoomInBgrndRct"/>
                <ContentControl HorizontalAlignment="Center" x:Name="contentControl" VerticalAlignment="Center" Content="Hybrid" FontSize="11" Foreground="#EEE3E3E3"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#FFFFFFFF"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#F965BDFF"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="TerrainToggleButtonCtrlTemplate" TargetType="{x:Type ToggleButton}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="ZoomInBgrndRct"/>
                <ContentControl HorizontalAlignment="Center" x:Name="contentControl" VerticalAlignment="Center" Content="Terrain" FontSize="11" Foreground="#EEE3E3E3"/>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#FFFFFFFF"/>
                </Trigger>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Foreground" TargetName="contentControl" Value="#F965BDFF"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="LeftButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="LeftBgrndRct"/>
                <Path Fill="#F2FFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" HorizontalAlignment="Stretch" Margin="10.366,4.491,3.449,8.593" x:Name="LeftArrowPath" VerticalAlignment="Stretch" Opacity="1" RenderTransformOrigin="0.142092680229453,0.500000007691215" Data="M1.5419999,0 L1.8476233,0.12659333 2.3394138,0.19133873 10.080815,4.6608386 C10.818343,5.0866503 11.071036,6.0297222 10.645226,6.76725 10.219415,7.5047777 9.2763425,7.757473 8.5388145,7.3316612 L3.0840001,4.1823225 3.0840001,10.481 C3.0840001,11.332623 2.3936234,12.023 1.5419999,12.023 0.69037711,12.023 -8.6916135E-08,11.332623 7.1054274E-15,10.481 L7.1054274E-15,1.542 0.18982393,1.0837243 0.2330026,0.75574995 0.36885397,0.6515075 0.45164128,0.45164127 0.83775319,0.29170851 1.1693147,0.037292377 1.3837976,0.065529556 z">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="-1" ScaleY="1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="-120"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="LeftArrowPath" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="RightButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="RightBgrndRct"/>
                <Path Fill="#F2FFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" HorizontalAlignment="Stretch" Margin="11.201,4.491,2.614,8.593" x:Name="RightArrowPath" VerticalAlignment="Stretch" Opacity="1" RenderTransformOrigin="0.142092680229453,0.500000007691215" Data="M1.5419999,0 L1.8476233,0.12659333 2.3394138,0.19133873 10.080815,4.6608386 C10.818343,5.0866503 11.071036,6.0297222 10.645226,6.76725 10.219415,7.5047777 9.2763425,7.757473 8.5388145,7.3316612 L3.0840001,4.1823225 3.0840001,10.481 C3.0840001,11.332623 2.3936234,12.023 1.5419999,12.023 0.69037711,12.023 -8.6916135E-08,11.332623 7.1054274E-15,10.481 L7.1054274E-15,1.542 0.18982393,1.0837243 0.2330026,0.75574995 0.36885397,0.6515075 0.45164128,0.45164127 0.83775319,0.29170851 1.1693147,0.037292377 1.3837976,0.065529556 z">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="120"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="RightArrowPath" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="UpButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="UpBgrndRct"/>
                <Path Fill="#F2FFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" HorizontalAlignment="Right" Margin="0,6.241,0.574,6.843" x:Name="UpArrowPath" VerticalAlignment="Stretch" Opacity="1" RenderTransformOrigin="0.142092680229453,0.500000007691215" Data="M1.5419999,0 L1.8476233,0.12659333 2.3394138,0.19133873 10.080815,4.6608386 C10.818343,5.0866503 11.071036,6.0297222 10.645226,6.76725 10.219415,7.5047777 9.2763425,7.757473 8.5388145,7.3316612 L3.0840001,4.1823225 3.0840001,10.481 C3.0840001,11.332623 2.3936234,12.023 1.5419999,12.023 0.69037711,12.023 -8.6916135E-08,11.332623 7.1054274E-15,10.481 L7.1054274E-15,1.542 0.18982393,1.0837243 0.2330026,0.75574995 0.36885397,0.6515075 0.45164128,0.45164127 0.83775319,0.29170851 1.1693147,0.037292377 1.3837976,0.065529556 z" Width="10.852">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="-1" ScaleY="1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="-30"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="UpArrowPath" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        <ControlTemplate x:Key="DownButtonCtrlTemplate" TargetType="{x:Type Button}">
            <Grid>
                <Rectangle Fill="#CB000000" Stroke="#F17693A1" RadiusX="3.5" RadiusY="3.5" x:Name="DownBgrndRct"/>
                <Path Fill="#F2FFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0.5" HorizontalAlignment="Right" Margin="0,6.991,0.574,6.093" x:Name="DownArrowPath" VerticalAlignment="Stretch" Opacity="1" RenderTransformOrigin="0.142092680229453,0.500000007691215" Data="M1.5419999,0 L1.8476233,0.12659333 2.3394138,0.19133873 10.080815,4.6608386 C10.818343,5.0866503 11.071036,6.0297222 10.645226,6.76725 10.219415,7.5047777 9.2763425,7.757473 8.5388145,7.3316612 L3.0840001,4.1823225 3.0840001,10.481 C3.0840001,11.332623 2.3936234,12.023 1.5419999,12.023 0.69037711,12.023 -8.6916135E-08,11.332623 7.1054274E-15,10.481 L7.1054274E-15,1.542 0.18982393,1.0837243 0.2330026,0.75574995 0.36885397,0.6515075 0.45164128,0.45164127 0.83775319,0.29170851 1.1693147,0.037292377 1.3837976,0.065529556 z" Width="10.852">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="-1" ScaleY="-1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="30"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                </Path>
            </Grid>
            <ControlTemplate.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Fill" TargetName="DownArrowPath" Value="#F14FB9E0"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
        
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFBBFF81" Offset="0"/>
            <GradientStop Color="#FFEEFFDF" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>

    <Border BorderBrush="Black" BorderThickness="1" CornerRadius="2" >
        <Grid x:Name="LayoutRoot" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <!--<RowDefinition Height="*"/>-->
            </Grid.RowDefinitions>

            <Border Grid.Row="0"  BorderThickness="1">
                <Border.BorderBrush >
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Black" Offset="0"/>
                        <GradientStop Color="Gray" Offset="1"/>
                    </LinearGradientBrush>
                </Border.BorderBrush>
            </Border>


            <Grid Margin="0,5" Grid.Row="0" x:Name="GridTitleBar" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="30" />
                    <ColumnDefinition Width="10" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>


                <TextBlock Grid.Row="0" Grid.ColumnSpan="6" x:Name="TextBlockTitle" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">Buddy Map</TextBlock>
                <TextBlock Grid.Row="1" Grid.ColumnSpan="6" x:Name="TextBlockTitleBuddy" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="18" FontWeight="SemiBold"></TextBlock>
                <TextBlock Grid.Row="2" Grid.ColumnSpan="6" x:Name="TextBlockTitleTimestamp" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="12" FontWeight="SemiBold"></TextBlock>


                <!--<s:SurfaceButton ToolTip="Zoom In" Grid.Column="1" x:Name="ButtonZoomIn" Click="ButtonZoomIn_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/calculator - addition.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </s:SurfaceButton>
                <s:SurfaceButton ToolTip="Zoom Out" Grid.Column="2" x:Name="ButtonZoomOut" Click="ButtonZoomOut_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/calculator - minus.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </s:SurfaceButton>-->
                <s:SurfaceButton Visibility="Collapsed" ToolTip="Refresh" Grid.Column="4" x:Name="ButtonOptions" Click="ButtonOptions_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/tools.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </s:SurfaceButton>
                <s:SurfaceButton ToolTip="Refresh" Grid.Column="4" x:Name="ButtonRefresh" Click="ButtonRefresh_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/refresh.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </s:SurfaceButton>
                <s:SurfaceButton ToolTip="Close" Grid.Column="5" x:Name="ButtonClose" Click="ButtonClose_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/calculator - multiply.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </s:SurfaceButton>
            </Grid>



            <!-- <Grid Margin="0,5" Grid.Row="0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="357*" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                </Grid.ColumnDefinitions>
                <TextBlock Margin="10,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold"> Buddy Map</TextBlock>
                
                
                
                <Button ToolTip="Refresh" Grid.Column="1" x:Name="ButtonRefresh" Click="ButtonRefresh_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/refresh.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>
                <Button ToolTip="Close" Grid.Column="2" x:Name="ButtonClose" Click="ButtonClose_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/calculator - multiply.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>
            </Grid>-->


            <!--<Grid Grid.Row="1" Margin="3,3,3,0" Background="Transparent" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="397*"></RowDefinition>-->
                    <!--<RowDefinition Height="*"></RowDefinition>-->
                    <!--<RowDefinition Height="*"></RowDefinition>-->
                <!--</Grid.RowDefinitions>-->
                <!--<Rectangle Stroke="#FF819DA3" x:Name="BgndRectangle" StrokeThickness="1" Fill="#FFFFFFFF" RadiusY="6.25" RadiusX="6.25" MouseLeftButtonDown="BgndRectangle_MouseLeftButtonDown" Height="580" Margin="0,0,0,-46" Grid.RowSpan="2" />-->
                <!--<Grid VerticalAlignment="Top" Height="23" x:Name="TitleGrid">
                    <TextBlock HorizontalAlignment="Left" Margin="9.667,6.066,0,2.647" x:Name="TitleTxtBlck" Width="30" FontSize="12" FontWeight="Normal" Foreground="#EEAFA780" Text="WPF" TextWrapping="Wrap" FontFamily="Myriad Pro" Visibility="Visible"/>
                    <Button Style="{DynamicResource CloseButtonStyle}" Width="11.195" Content="Button" x:Name="CloseButton" Cursor="Hand" HorizontalAlignment="Right" Margin="0,5.583,9.468,4.647" Click="CloseButton_Click"/>
                    <Button Style="{DynamicResource MinimizeButtonStyle}" Width="12.402" Content="Button" x:Name="MinimizeButton" Cursor="Hand" HorizontalAlignment="Right" Margin="0,4.733,26.606,4.73" Click="MinimizeButton_Click"/>
                </Grid>-->
                <!-- Margin="17,24,17
            ,277" -->
            <!--<Canvas x:Name="MapImageCanvas" Grid.Row="1" Margin="8,8,8,8" Canvas.Top="0" Canvas.Left="0" Canvas.Right="0" Canvas.Bottom="0"  MouseDown="MapImageCanvas_MouseDown" MouseMove="MapImageCanvas_MouseMove">-->
 
            <Grid Grid.Row="1" x:Name="MapImageGrid" Background="{x:Null}" Margin="3,3,3,3" >
                <!--<Rectangle Fill="#FFEAEAEA" Stroke="{x:Null}" x:Name="MIGBgndRct" StrokeThickness="0.6" Margin="0,0,0,0" />-->
            <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0"  >

               
                    <Image Canvas.Top="0" Canvas.Bottom="0" Canvas.Right="0" Canvas.Left="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                       x:Name="MapImage" MouseLeftButtonUp="MapImage_MouseLeftButtonUp" MouseMove="MapImage_MouseMove" 
                    MouseDown="MapImage_MouseDown" MouseUp="MapImage_MouseUp"  PreviewMouseDown="MapImage_PreviewMouseDown" 
                    PreviewMouseMove="MapImage_PreviewMouseMove" />

                <!--<Rectangle Fill="{x:Null}" Stroke="#FF000000" x:Name="ImageRct" StrokeThickness="0.6" Margin="0,0,0,0" />-->
                <!--<ProgressBar Margin="179,189,179,219" IsIndeterminate="True" x:Name="MapProgressBar" Visibility="Collapsed"/>-->

                <!--<Viewbox HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Height="Auto" Stretch="Fill" x:Name="ZoomAndSaveVwBox">
                    <Grid>-->
                
                <StackPanel Margin="5" Canvas.Left="0" Canvas.Top="0">
                        <!--
                        <Button HorizontalAlignment="Left" Margin="7.667,71,0,0" VerticalAlignment="Top" Width="24.667" Height="25.107" Content="" Template="{DynamicResource ZoomInButtonCtrlTemplate}" Cursor="Hand" x:Name="ZoomInButton" IsEnabled="True" Click="ZoomInButton_Click"/>
                        <Button Cursor="Hand" HorizontalAlignment="Left" Margin="7.667,39,0,0" x:Name="ZoomOutButton" VerticalAlignment="Top" Width="24.667" Height="25.107" Content="" Template="{DynamicResource ZoomOutButtonCtrlTemplate}" IsEnabled="True" Click="ZoomOutButton_Click"/>
                        <Button Cursor="Hand" HorizontalAlignment="Left" Margin="7.667,7,0,0" x:Name="SaveButton" VerticalAlignment="Top" Width="24.667" Height="25.107" Content="" Template="{DynamicResource SaveButtonControlTemplate}" ToolTip="Save map" IsEnabled="True" Click="SaveButton_Click"/>
                        -->
                    <Button Margin="2" Width="24.667" Height="25.107" Content="" Template="{DynamicResource ZoomInButtonCtrlTemplate}" Cursor="Hand" x:Name="ZoomInButton" IsEnabled="True" Click="ZoomInButton_Click"/>
                    <Button Margin="2" Cursor="Hand" x:Name="ZoomOutButton" Width="24.667" Height="25.107" Content="" Template="{DynamicResource ZoomOutButtonCtrlTemplate}" IsEnabled="True" Click="ZoomOutButton_Click"/>
                    <Button Margin="2" Cursor="Hand" x:Name="SaveButton" Width="24.667" Height="25.107" Content="" Template="{DynamicResource SaveButtonControlTemplate}" ToolTip="Save map" IsEnabled="True" Click="SaveButton_Click"/>
                </StackPanel>
                <!--</Grid>
                </Viewbox>-->
            
                <!--<Viewbox HorizontalAlignment="Right" VerticalAlignment="Top" Stretch="Fill" x:Name="MapTypeVwBox">
                    <Grid>-->
                <StackPanel Margin="5" Orientation="Horizontal" Canvas.Right="0">
                        <ToggleButton Margin="2" Height="23" Content="Roadmap" Width="78" Template="{DynamicResource RoadmapButtonCtrlTemplate}" IsChecked="False" Cursor="Hand" x:Name="RoadmapToggleButton" IsEnabled="True" Click="RoadmapToggleButton_Checked"/>
                        <ToggleButton Margin="2" Height="23" Content="" Width="78" Template="{DynamicResource TerrainToggleButtonCtrlTemplate}" x:Name="TerrainToggleButton" Cursor="Hand" IsEnabled="True" Click="TerrainToggleButton_Checked" />
                </StackPanel>
                <!--</Grid>
                </Viewbox>-->
                    <!--<Viewbox Margin="5" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="66.001" Height="43.636" Canvas.Right="0" Canvas.Bottom="0" Stretch="Fill" x:Name="MoveBtnsVwBox" >\-->
                       <Grid Canvas.Bottom="0" Canvas.Right="0" Width="82.001" Height="54.2139999999999" >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="19*" />
                            <RowDefinition Height="35*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="67*" />
                            <ColumnDefinition Width="15*" />
                        </Grid.ColumnDefinitions>
                        <Button Height="25.107" Content="" Template="{DynamicResource UpButtonCtrlTemplate}" x:Name="MoveUpButton" IsEnabled="True" Margin="29,0,14,0" VerticalAlignment="Top" Click="MoveUpButton_Click" Grid.RowSpan="2" />
                            <Button x:Name="MoveDownButton" Height="25.107" Content="" Template="{DynamicResource DownButtonCtrlTemplate}" IsEnabled="True" Margin="29,0,14,0" VerticalAlignment="Bottom" Click="MoveDownButton_Click" Grid.Row="1" />
                            <!--<Button x:Name="MoveCenterButton" Height="25.107" Content="" Template="{DynamicResource DownButtonCtrlTemplate}" IsEnabled="True" Margin="28.667,0,28.667,0" VerticalAlignment="Bottom" Click="MoveDownButton_Click"/> -->
                            <Button x:Name="MoveLeftButton" Width="24.667" Content="" Template="{DynamicResource LeftButtonCtrlTemplate}" IsEnabled="True" HorizontalAlignment="Left" Margin="0,14,0,15" Click="MoveLeftButton_Click" Grid.RowSpan="2" />
                            <Button x:Name="MoveRightButton" Width="24.667" Content="" Template="{DynamicResource RightButtonCtrlTemplate}" IsEnabled="True" HorizontalAlignment="Right" Margin="0,14,0,15" Click="MoveRightButton_Click" Grid.ColumnSpan="2" Grid.RowSpan="2" />
                       </Grid>
                    <!--</Viewbox>-->
                <TextBlock Visibility="Collapsed" VerticalAlignment="Bottom" Height="21" Text="XXXXXXXXX, XXXX, XXXXX" TextWrapping="Wrap" FontSize="12" TextAlignment="Center" x:Name="AddressTxtBlck"/>
                <TextBox Visibility="Collapsed" VerticalAlignment="Bottom" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="AddressTxtBox" FontFamily="Segoe UI"/>
                <StackPanel Orientation="Horizontal" Visibility="Collapsed">
                    <Label   >Latitude</Label>
                    <TextBox Width="100" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="TextBoxLat" FontFamily="Segoe UI"/>
                    <Label   >Longitude</Label>
                    <TextBox Width="100" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="TextBoxLon" FontFamily="Segoe UI"/>
                    <Button  Content="ShowLatLon" Cursor="Hand" FontFamily="Myriad Pro" FontSize="12" Foreground="#FFFFFFFF" Height="24" IsDefault="True" Name="buttonShowLatLon" Template="{DynamicResource ShowButtonControlTemplate}" Click="buttonShowLatLon_Click" />
                </StackPanel>
                </Canvas>
          </Grid>
            
            <!--</Canvas>-->
<!--
                <Grid Visibility="Collapsed" VerticalAlignment="Bottom" Height="23" x:Name="LatLngGrid">
                    <TextBlock HorizontalAlignment="Left"  x:Name="LatTxtBlck" Width="53" FontSize="12" Foreground="#FF7E0000" Text="Latitude:" TextWrapping="Wrap"/>
                    <TextBlock HorizontalAlignment="Left"  x:Name="LatitudeTxtBlck" Width="82" FontSize="12" Foreground="#FF2871A5" Text="XXXXXXXXXX" TextWrapping="Wrap"/>
                    <TextBlock  x:Name="LngTxtBlck" FontSize="12" Foreground="#FF7E0000" Text="Longitude:" TextWrapping="Wrap"/>
                    <TextBlock  x:Name="LongitudeTxtBlck" FontSize="12" Foreground="#FF2871A5" Text="XXXXXXXXXX" TextWrapping="Wrap" HorizontalAlignment="Right" Width="82"/>
                    <Rectangle Stroke="{x:Null}" StrokeThickness="1" RadiusX="0.919" RadiusY="0.919" HorizontalAlignment="Left" x:Name="SeparatorTriangle" Width="2.124">
                        <Rectangle.Fill>
                            <LinearGradientBrush EndPoint="0.972,0.5" StartPoint="0.028,0.5">
                                <GradientStop Color="#FF7C7C7C" Offset="0"/>
                                <GradientStop Color="#FFA1A1A1" Offset="1"/>
                                <GradientStop Color="#FFB7B4B4" Offset="0.29"/>
                                <GradientStop Color="#FFC4C4C4" Offset="0.545"/>
                                <GradientStop Color="#FFB9B7B7" Offset="0.728"/>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Grid HorizontalAlignment="Right" Margin="0,0,0,5" x:Name="ApproxPrecGrid" Width="82.336">
                        <Rectangle Fill="#FF001E2F" Stroke="#FF778C99" StrokeThickness="1" RadiusX="0" RadiusY="0" Margin="0,0,0.002,0"/>
                        <TextBlock Margin="0.003,1.165,0,0.835" x:Name="AccuracyTxtBlck" FontSize="11" Foreground="#FFFFFFFF" Text="XXXXXXX" TextWrapping="Wrap" TextAlignment="Center" FontFamily="Segoe UI"/>
                    </Grid>
                </Grid>
                <TextBox Visibility="Collapsed" VerticalAlignment="Bottom" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="AddressTxtBox" FontFamily="Segoe UI"/>
                <Button Visibility="Collapsed" HorizontalAlignment="Right"  VerticalAlignment="Bottom" Width="84" Height="24" Content="Show" Template="{DynamicResource ShowButtonControlTemplate}" Foreground="#FFFFFFFF" FontFamily="Myriad Pro" FontSize="12" Cursor="Hand" x:Name="ShowMapButton" IsDefault="True" Click="ShowMapButton_Click" />


            <Grid Visibility="Collapsed" >
                <StackPanel Orientation="Horizontal">
                        <Label   >Latitude</Label>
                        <TextBox  Width="100" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="TextBoxLat" FontFamily="Segoe UI"/>
                        <Label   >Longitude</Label>
                        <TextBox Width="100" Margin="0,0,0,20" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="26" Text="" TextWrapping="Wrap" FontSize="14" x:Name="TextBoxLon" FontFamily="Segoe UI"/>
                        <Button  Content="ShowLatLon" Cursor="Hand" FontFamily="Myriad Pro" FontSize="12" Foreground="#FFFFFFFF" Height="24" IsDefault="True" Name="buttonShowLatLon" Template="{DynamicResource ShowButtonControlTemplate}" Width="84" Click="buttonShowLatLon_Click" />
                    </StackPanel>
                </Grid>-->

                <!--<Grid Visibility="Collapsed" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock FontWeight="Bold" FontSize="14"><Run Text="Roster"/></TextBlock>
                    <CheckBox Grid.Column="1" Margin="10,0" x:Name="CheckBoxSHowAll" IsChecked="{Binding ShowAll}">Show All</CheckBox>
                </Grid>-->

            <!-- <ListBox x:Name="ListBoxRoster" Visibility="Collapsed" BorderBrush="{x:Null}" Background="{x:Null}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 SelectionChanged="ListBoxRoster_SelectionChanged"
                 SelectionMode="Multiple"
                 ItemsSource="{Binding Source={StaticResource SortedRosterItems}}"
                 ItemTemplate="{StaticResource ChatMessageTemplate}" Margin="0,0,0,177">


                   <ListBox.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Rectangle x:Name="Rectangle" Stretch="Fill" >
                                            <Rectangle.Fill>
                                                <LinearGradientBrush StartPoint="0,.5" EndPoint="1,.5">
                                                    <GradientStop Color="#00FF00FF" Offset="0"/>
                                                    <GradientStop Color="#44FF00FF" Offset=".5"/>
                                                    <GradientStop Color="#00FF00FF" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <TextBlock HorizontalAlignment="Center"  FontWeight="Bold" FontSize="12" Text="{Binding Path=Name}" />
                                    </Grid>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                        </GroupStyle>
                    </ListBox.GroupStyle>

                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ListBoxItem">
                                        <Border Name="Border" Padding="2"  SnapsToDevicePixels="true">
                                            <ContentPresenter />
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="true">
                                                <Setter TargetName="Border" Property="Background" Value="{x:Null}"/>
                                                <Setter TargetName="Border" Property="BorderBrush" Value="Blue"/>
                                                <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,1"/>
                                            </Trigger>
                                            <Trigger Property="IsSelected" Value="false">
                                                <Setter TargetName="Border" Property="Background" Value="#66000000"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>

                            <Style.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding Presence.IsOnline}" Value="False"  />
                                        <Condition Binding="{Binding DataContext.ShowAll, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}"  Value="False"  />
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                </MultiDataTrigger>

                                <DataTrigger Binding="{Binding DataContext.ShowAll, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}"  Value="True"  >
                                    <Setter Property="Visibility" Value="Visible"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </ListBox.ItemContainerStyle>

                </ListBox>-->

            <!--<Grid Visibility="Collapsed" >
                <StackPanel>
                        <ListBox x:Name="ListViewBuddies" 
                                  
                                  >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal" >
                                                                                   
                                            <CheckBox x:Name="CheckBoxCenterOnBuddy" IsChecked="{Binding Path=bCenterOnBuddy}" Checked="CheckBoxCenterOnBuddy_Checked" >Center Map on Buddy</CheckBox>
                                            <CheckBox x:Name="CheckBoxShowOnMap" IsChecked="{Binding Path=bShowOnMap}" Checked="CheckBoxShowOnMap_Checked">Show on Map</CheckBox>

                                        <StackPanel Orientation="Vertical">
                                            <StackPanel Orientation="Horizontal">

                                                <Label FontWeight="Bold">Name</Label>
                                                <TextBlock Width="200" VerticalAlignment="Center" Text="{Binding Path=RosterItem.JID}" />

                                            </StackPanel>
                                            <StackPanel Orientation="Horizontal">

                                                <Label FontWeight="Bold">Location</Label>
                                                <TextBlock Width="200" VerticalAlignment="Center" Text="{Binding Path=RosterItem.GeoString}" />

                                                <Label FontWeight="Bold">Timestamp</Label>
                                                <TextBlock Width="200" VerticalAlignment="Center" Text="{Binding Path=RosterItem.GeoLoc.Timestamp}" />

                                            </StackPanel>
                                        </StackPanel>
                                        <Label FontWeight="Bold" Margin="10,0">Count</Label>
                                            <TextBlock Width="50" VerticalAlignment="Center" Text="{Binding Path=Count}" />
                                            <ToggleButton Margin="10,0" x:Name="ToggleButtonStartRecording" Click="ToggleButtonStartRecording_Click">Record</ToggleButton>
                                            <Button Margin="10,0" x:Name="ButtonSaveKML" Click="ButtonSaveKML_Click">Save KML</Button>

                                            <Button Margin="10,0" x:Name="ButtonClearKML" Click="ButtonClearKML_Click">Clear</Button>
                                        </StackPanel>
                                   
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </Grid>-->

                
                
            <!--</Grid>-->
       

        </Grid>
    </Border>
</Window>
